<?php
require_once 'application/library/db/gcDaoFactory.php';
require_once 'application/library/helper/amountHelper.php';
require_once 'application/constant/daoConfig.php';

/**
 * 订单编辑Service
 * @author    Soochow University
 * @version   1.0
 * @exclude   作  成  日：2011/04/07
 */
class order_services_orderEditService {

    private $objDaoFactory;

    public function __construct(){
        $this->objDaoFactory = gcDaoFactory::getInstance();
    }

    /**
     * 供应商总数取得
     * pbGetSupplierSum
     * @return  int     $intReturn
     */
    public function pbGetSupplierSum(){
        $objTestDao = $this->objDaoFactory->createDao(daoConfig::T_AD_M_SUPPLIER_DAO);
        $intReturn = $objTestDao->pbGetSupplierSum();
        return $intReturn;
    }

    /**
     * 供应商情报一览取得
     * pbGetSupplierData
     * @param   array   $arrParameter
     * @return  array   $arrReturn
     */
    public function pbGetSupplierData($arrParameter, $arrSession){
        $objTestDao = $this->objDaoFactory->createDao(daoConfig::T_AD_M_SUPPLIER_DAO);
        $arrReturn = $objTestDao->pbGetSupplierData($arrParameter, seachType::SEARCH_TYPE);
        foreach ($arrReturn as $k => &$value) {
            $value["NO"] = $arrParameter["offset"] + $k + 1;
            if (!empty($arrSession["SupplierInfo"])) {
                foreach ($arrSession["SupplierInfo"] as $j => $valuej) {
                    if($value["SUPPLIER_NO"] == $valuej["SUPPLIER_NO"]) {
                        $value["disableFlag"] = 1;
                    } else {
                    }
                }
            } else {}
        }
        return $arrReturn;
    }

    /**
     * 供应商情报一览件数取得
     * pbGetSupplierDataCount
     * @param   array   $arrParameter
     * @return  array   $arrReturn
     */
    public function pbGetSupplierDataCount($arrParameter){
        $objTestDao = $this->objDaoFactory->createDao(daoConfig::T_AD_M_SUPPLIER_DAO);
        $arrReturn = $objTestDao->pbGetSupplierData($arrParameter, seachType::COUNT_TYPE);
        return $arrReturn;
    }

    /**
     * 供应商情报下载
     * pbGetDownloadData
     * @param   array   $arrParameter
     * @return  array   $arrReturn
     */
    public function pbGetDownloadData($arrParameter){
        $objTestDao = $this->objDaoFactory->createDao(daoConfig::T_AD_M_SUPPLIER_DAO);
        $arrReturn = $objTestDao->pbGetSupplierData($arrParameter, seachType::DOWNLOAD_TYPE);
        return $arrReturn;
    }
}   